package com.citycloud.ccuap.tc.sync.dto;


import com.citycloud.ccuap.commons.sys.entity.SysUser;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author zjl
 * @date 2020/04/27 19:40
 */
@Data
public class UserMessageDTO implements Serializable {

    /**用户ID*/
    private Long userId;
    /**用户编号*/
    private String userNo;
    /**用户名*/
    private String userName;
    /**员工卡号*/
    private String cardNo;
    /**性别*/
    private Short sex;
    /**部门ID*/
    private Long deptId;
//    /**机构ID*/
//    private Long groupId;
    /**站点ID*/
    private Long projectId;
    /**手机号*/
    private String telephone;
    /**联系地址*/
    private String address;
    /**邮箱*/
    private String email;
    /**出生年月*/
    private Date birthday;
    /**创建时间*/
    private Date createTime;
    /**用户等级*/
    private Short userGrade;
    /**职务标识*/
    private Integer postId;
    /**用户类型*/
    private Short type;
    /**启用/停用*/
    private Boolean status;
    /**执行版本*/
    private Integer version;
    /**备注*/
    private String remark;
    /**办公室电话*/
    private String officeTel;
    /**头像路径*/
    private String iconFilePath;

    public UserMessageDTO build(SysUser user){
        this.userId = user.getUserId();
        this.userNo = user.getUserNo();
        this.userName = user.getUserName();
        this.cardNo = user.getCardNo();
        this.sex = user.getSex();
        this.deptId = user.getDeptId();
        this.projectId = user.getProjectId();
        this.telephone = user.getTelephone();
        this.address = user.getAddress();
        this.email = user.getEmail();
        this.birthday = user.getBirthday();
        this.createTime = user.getCreatedTime();
        this.userGrade = user.getUserGrade();
//        this.postId = user.getPostId();
        this.postId = null;
        this.type = user.getType();
        this.status = (user.getDataStatus() == 0)?false :true;
        this.version = user.getVersion();
        this.remark = user.getRemark();
        this.officeTel = user.getOfficeTel();
        this.iconFilePath = user.getIconFilePath();
        return this;
    }

}
